package main

import (
	"fmt"
	"log"
	"net"
	"projectbao/pb"
	"projectbao/service"

	"google.golang.org/grpc"
)

func main() {
	rpcServer := grpc.NewServer()
	pb.RegisterProductServiceServer(rpcServer, service.ProductService)
	listion, err := net.Listen("tcp", ":8002")
	if err != nil {
		log.Fatal("启动监听出错", err)
	}
	err = rpcServer.Serve(listion)
	if err != nil {
		log.Fatal("启动服务器出错", err)
	}
	fmt.Println("启动grpc服务端成功")
}
